package cn.brilliantfuture.commentry.entity;

// Generated Apr 5, 2010 3:00:19 PM by Hibernate Tools 3.2.5.Beta

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.validator.NotNull;

/**
 * RolePrivilege generated by hbm2java
 */
@Entity
@Table(name = "role_privilege", catalog="cabinet")
public class RolePrivilege implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer rolePrivilegeId;
	private Privilege privilege;
	private Role role;

	public RolePrivilege() {
	}

	public RolePrivilege(Privilege privilege, Role role) {
		this.privilege = privilege;
		this.role = role;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "role_privilege_id", unique = true, nullable = false)
	public Integer getRolePrivilegeId() {
		return this.rolePrivilegeId;
	}

	public void setRolePrivilegeId(Integer rolePrivilegeId) {
		this.rolePrivilegeId = rolePrivilegeId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "privilege_id", nullable = false)
	@NotNull
	public Privilege getPrivilege() {
		return this.privilege;
	}

	public void setPrivilege(Privilege privilege) {
		this.privilege = privilege;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id", nullable = false)
	@NotNull
	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

}
